<?php

namespace app\controller;

use app\Controller;
use app\model\Help as Model;
use think\facade\View;

class Help extends Controller
{
    /**
     * 列表.
     * 
     * @return array
     */
    public function index()
    {
        $result = Model::withSearch(['status'], input('get.'))->paginate([
            'list_rows'=> input('get.pageSize/d', 10),
        ]);
        return json([
            'items' => $result->items(),
            'total' => $result->total()
        ]);
    }
    /**
     * 详情.
     * 
     * @return array
     */
    public function read(string $type = 'rule')
    {
        $model = Model::where('type', $type)->findOrEmpty();
        return json($model->toArray());
    }
}
